<%= form_with(model: stack_manager, url: stack_manager_path, local: local_form ||= false) do |form| %>
  <%= render "shared/error_messages", resource: form.object %>

  <div class="form-control">
    <%= form.label :stack_manager_type do %>
      Stack Manager Type
    <% end %>
    <%= form.select :stack_manager_type, 
        options_for_select(StackManager.stack_manager_types.map {|k,v| [k.humanize, k]}, stack_manager.stack_manager_type),
        {},
        class: "select select-bordered w-full" %>
  </div>

  <div class="form-control mt-4">
    <%= render "accounts/stack_managers/url", form: form %>
  </div>

  <div class="mt-4">
    <div class="alert alert-warning">
      <iconify-icon icon="lucide:alert-triangle" height="20"></iconify-icon>
      <span>Changes to the stack manager could affect cluster connectivity.</span>
    </div>
  </div>
  <div class="form-footer flex justify-end gap-2">
    <% if account.stack_manager %>
      <%= link_to(
        "Cancel",
        stack_manager_path,
        class: "btn btn-ghost",
        data: { turbo_frame: "current_account_stack_manager" },
      ) %>
    <% end %>
    <%= form.submit "Save Configuration", class: "btn btn-primary" %>
  </div>
<% end %>